<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="/js/plugin/layui-v2.3.0/layui/css/layui.css">
	<link rel="stylesheet" href="/css/reset.css">
	<link rel="stylesheet" href="/css/index.css">
	<link rel="stylesheet" href="/css/project_set.css">
	<script src="/js/jquery-2.1.1.min.js"></script>
	<script src="/js/plugin/layui-v2.3.0/layui/layui.js"></script>
	<script src="/js/common.js"></script>
<script>
	$(document).ready(function() {
		initFormSelects("fkProject","/app/projectBuilding/selectjson",$("#fkProjectid").val());
		initFormSelects("fkFloor","/app/projectFloor/selectjson/"+$("#fkProjectid").val(),$("#fkFloorid").val());
		
		if("1"==$("#wallid").val()){
			$("#wall").attr("checked","checked");
		}
		if("1"==$("#lockid").val()){
			$("#lock").attr("checked","checked");
		}
		var partitionTypeid=$("#partitionTypeid").val();
		var orientationid=$("#orientationid").val();
		$(":radio[name='partitionType'][value='"+partitionTypeid+"']").attr("checked","checked");  
		$(":radio[name='orientation'][value='"+orientationid+"']").attr("checked","checked");  
	});
	
</script>
<style>
.layui-form-label{
	text-align:left
}
.kb-form-container{
	padding-left:20px;
}
.layui-form-item .layui-inline{
	margin-right:0px
}
</style>
</head>
<body style="overflow-y:scroll">
<input type="hidden" id="fkProjectid" name="fkProjectid" th:value="${record.fkProject}" />
<input type="hidden" id="fkFloorid" name="fkFloorid" th:value="${record.fkFloor}" />
<input type="hidden" id="partitionTypeid" name="partitionTypeid" th:value="${record.partitionType}" />
<input type="hidden" id="orientationid" name="orientationid" th:value="${record.orientation}" />
<input type="hidden" id="lockid" name="lockid" th:value="${record.lock}" />
<input type="hidden" id="wallid" name="wallid" th:value="${record.wall}" />
<div class="addemployee-wrap" id="employee-wrap">
<span style="color: rgb(153, 153, 153); font-size: 14px; padding: 35px;">分区是空间中不同位置的区域,如独立的办公室或同一位置的开放工位区</span>
	<div class="kb-form-container" >
		<form class="layui-form" id="defaultForm" th:action="@{/app/projectPartition/update}" th:method="post" lay-filter="employee-form">
			<input type="hidden" id="id" name="id" th:value="${record.id}" />
			<fieldset class="fieldset">
				<div class="layui-form-item">
				    <label class="layui-form-label"><span class="must-fill">*</span>名称</label>
				    <div class="layui-input-block">
				      	<input type="text" name="partitionName" id="partitionName" th:value="${record.partitionName}" required  lay-verify="partitionName" placeholder="" autocomplete="off" class="layui-input">
				    	<span style="color: rgb(153, 153, 153); font-size: 12px; padding: 4px 0px 0px;">可根据位置或者编号进行命名,如南1区,ROOM101</span>
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-inline">
					    <label class="layui-form-label"><span class="must-fill">*</span>所属大厦</label>
					        <div class="layui-input-inline" style="width: 200px;">
					            <select name="fkProject" id="fkProject" lay-filter="fkProject" lay-verify="fkProject">
							    </select>
					        </div>
				    </div>
				     <div class="layui-inline">
					        <label class="layui-form-label text-r" style="width: 80px;"><span class="must-fill">*</span>所属楼层</label>
					        <div class="layui-input-inline" style="width:200px;">
					            <select name="fkFloor" id="fkFloor" lay-filter="fkFloor" lay-verify="fkFloor">
							    </select>
					        </div>
				     </div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label"><span class="must-fill">*</span>类型</label>
				    <div class="layui-input-block">
				    	<input name="partitionType" lay-verify="partitionType" title="封闭办公室" type="radio" value="2"/>
				      	<input name="partitionType" title="开放办公室" type="radio" value="1" />
			     	 	<br>
			     	 	<span style="color: rgb(153, 153, 153); font-size: 12px; padding: 4px 0px 0px;">有多个合同的分区不能更改为封闭分区</span>
				    </div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label"><span class="must-fill">*</span>容纳人数</label>
				    <div class="layui-input-block">
				      	<input type="text" name="partitionNumber" id="partitionNumber" th:value="${record.partitionNumber}" required  lay-verify="partitionNumber" placeholder="" autocomplete="off" class="layui-input">
				    </div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label"><span class="must-fill">*</span>面积</label>
				    <div class="layui-input-block">
				      	<input type="text" name="area" id="area" required lay-verify="area" th:value="${record.area}"  placeholder="" autocomplete="off" class="layui-input">
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-inline">
					    <label class="layui-form-label">价格</label>
					        <div class="layui-input-inline" style="width: 200px;">
					            <input autocomplete="off" class="layui-input" name="price" th:value="${record.price}" placeholder="" type="tel" />
					        </div>
				    </div>
				     <div class="layui-inline">
					        <label class="layui-form-label text-r" style="width: 80px;">非入驻价格</label>
					        <div class="layui-input-inline" style="width:200px;">
					            <input autocomplete="off" class="layui-input" th:value="${record.wrongPrice}" name="wrongPrice" placeholder="" type="tel" />
					        </div>
				     </div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">朝向</label>
				    <div class="layui-input-block">
				      	<input name="orientation" title="东" type="radio" value="3"/>
				      	<input name="orientation" title="西" type="radio" value="2" />
			     	 	<input name="orientation" title="南" type="radio" value="1" />
			     	 	<input name="orientation" title="北" type="radio" value="0" />
				    </div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">硬件设备</label>
				    <div class="layui-input-block">
				      	<input name="lock" id="lock" title="有锁" lay-skin="primary" type="checkbox" value="1" />
				      	<input name="wall" id="wall" title="靠墙" lay-skin="primary" type="checkbox" value="1" />
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-inline">
					    <label class="layui-form-label">使用率</label>
				        <div class="layui-input-inline" style="width: 200px;">
				            <input autocomplete="off" class="layui-input" th:value="${record.usageRate}" name="usageRate" placeholder="" type="tel" />
				            <span style="color: rgb(153, 153, 153); font-size: 12px; padding: 4px 0px 0px;">总物理面积比率</span>
				        </div>
				    </div>
				     <div class="layui-inline">
				        <label class="layui-form-label text-r" style="width: 80px;">签约得房率</label>
				        <div class="layui-input-inline" style="width:200px;">
				            <input autocomplete="off" class="layui-input" th:value="${record.contractRoomRate}" name="contractRoomRate" placeholder="" type="tel" />
				            <span style="color: rgb(153, 153, 153); font-size: 12px; padding: 4px 0px 0px;">可出租面积比率</span>
				        </div>
				     </div>
				</div>
			</fieldset>
			<fieldset class="fieldset">	
				<div class="layui-form-item" style="">
				    <div class="layui-input-block">
				      <button class="layui-btn layui-btn-normal btn-bg" lay-submit lay-filter="formEmployee" id="submit-btn">提交</button>
				      <a class="layui-btn layui-btn-primary" onclick="closeLayer()">取消</a>
				    </div>
				</div>
			</fieldset>
		</form>	
	</div>
</div>
</body>
<script>
	
	layui.config({
	        base: '/js/plugin/layui-v2.3.0/layui/' //此处路径请自行处理, 可以使用绝对路径
	    }).extend({
	        formSelects: 'formSelects-v3'
	    }).use(['element',"layer","form",'formSelects'], function(){
			var layer=layui.layer,form = layui.form,formSelects = layui.formSelects;
			form.on('select(fkProject)', function(data){
				initFormSelects("fkFloor","/app/projectFloor/selectjson/"+data.value,"");
			});
			 
			form.verify({
				partitionName: function(value, item){ //value：表单的值、item：表单的DOM对象
		      	  if(value==""){
			       	  return '名称不能为空';
			      }
			  }
				,fkProject: function(value, item){ //value：表单的值、item：表单的DOM对象
		      	  if(value==""){
			       	  return '大厦不能为空';
			      }
			  }
				,fkFloor: function(value, item){ //value：表单的值、item：表单的DOM对象
		      	  if(value==""){
			       	  return '楼层不能为空';
			      }
			  }
			  ,partitionType: function(value, item){ 
				  var val=$('input:radio[name="partitionType"]:checked').val();
		      	  if(val==null){
			       	  return '类型不能为空';
			      }
			  }
			  ,partitionNumber: function(value, item){ //value：表单的值、item：表单的DOM对象
			    if(value==""){
			    	return '人数不能为空';
			    }
			  }
			  ,area: function(value, item){ //value：表单的值、item：表单的DOM对象
			     if(value==""){
			     	return '面积不能为空';
			     }else if(!new RegExp("^\\d+(\\.\\d+)?$").test(value)){
				      return '面积不能有特殊字符';
				    }
			  }
			  
			}); 
			//监听提交
			  form.on('submit(formEmployee)', function(data){
				  $.post($("#defaultForm").attr('action'), data.field, function(result) {
						window.parent.layer.msg(result.msg);
						closeLayer();
					}, 'json');
					return false;
			  });
			
		});
</script>
</html>